package com.probiz.estore.common.model.inventory.base;

import java.io.Serializable;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.inventory.InventoryAudit;
import com.probiz.estore.common.model.product.ProductSku;
import com.probiz.estore.core.model.BaseObject;

/**
 * Inventory Base Java Bean, base class for the model, mapped directly to
 * database table
 * <p/>
 * Avoid changing this file if not necessary, will be overwritten.
 */
public class InventoryTbl extends BaseObject implements Serializable {

    protected Integer inventoryId;
    protected Integer quantityOnHand;
    protected Integer allocatedQuantity;
    protected Integer reorderMinimnm;
    protected Date createTime;
    protected Date updateTime;
    protected Integer version;
    protected Set<ProductSku> productSkus = new HashSet<ProductSku>();
    protected Set<InventoryAudit> inventoryAudits = new HashSet<InventoryAudit>();

    /**
     * Default Empty Constructor for class Inventory
     */
    public InventoryTbl() {
        super();
    }

    /**
     * Default Key Fields Constructor for class Inventory
     *
     * @param in_inventoryId 库存id
     */
    public InventoryTbl(Integer in_inventoryId) {
        this.setInventoryId(in_inventoryId);
    }

    

    /**
     * *
     *
     * @return Integer
     * @hibernate.id column="inventoryId" type="java.lang.Integer"
     * generator-class="native"
     */
    public Integer getInventoryId() {
        return this.inventoryId;
    }

    /**
     * Set the inventoryId
     */
    public void setInventoryId(Integer aValue) {
        this.inventoryId = aValue;
    }

    
    /**
     * 现有库存 *
     *
     * @return Integer
     * @hibernate.property column="quantityOnHand" type="java.lang.Integer"
     * length="10" not-null="true" unique="false"
     */
    public Integer getQuantityOnHand() {
        return this.quantityOnHand;
    }

    /**
     * Set the quantityOnHand
     *
     * @spring.validator type="required"
     */
    public void setQuantityOnHand(Integer aValue) {
        this.quantityOnHand = aValue;
    }

    /**
     * 已分配数量 *
     *
     * @return Integer
     * @hibernate.property column="allocatedQuantity" type="java.lang.Integer"
     * length="10" not-null="true" unique="false"
     */
    public Integer getAllocatedQuantity() {
        return this.allocatedQuantity;
    }

    /**
     * Set the allocatedQuantity
     *
     * @spring.validator type="required"
     */
    public void setAllocatedQuantity(Integer aValue) {
        this.allocatedQuantity = aValue;
    }


    /**
     * 最少库存，当少于这值时提示低库存 *
     *
     * @return Integer
     * @hibernate.property column="reorderMinimnm" type="java.lang.Integer"
     * length="10" not-null="true" unique="false"
     */
    public Integer getReorderMinimnm() {
        return this.reorderMinimnm;
    }

    /**
     * Set the reorderMinimnm
     *
     * @spring.validator type="required"
     */
    public void setReorderMinimnm(Integer aValue) {
        this.reorderMinimnm = aValue;
    }

    public Set<ProductSku> getProductSkus() {
		return productSkus;
	}

	public void setProductSkus(Set<ProductSku> productSkus) {
		this.productSkus = productSkus;
	}

	public Set<InventoryAudit> getInventoryAudits() {
		return inventoryAudits;
	}

	public void setInventoryAudits(Set<InventoryAudit> inventoryAudits) {
		this.inventoryAudits = inventoryAudits;
	}

	/**
     * *
     *
     * @return Date
     * @hibernate.property column="createTime" type="Date" length="0"
     * not-null="true" unique="false"
     */
    public Date getCreateTime() {
        return this.createTime;
    }

    /**
     * Set the createTime
     *
     * @spring.validator type="required"
     */
    public void setCreateTime(Date aValue) {
        this.createTime = aValue;
    }

    /**
     * *
     *
     * @return Date
     * @hibernate.property column="updateTime" type="Date" length="0"
     * not-null="true" unique="false"
     */
    public Date getUpdateTime() {
        return this.updateTime;
    }

    /**
     * Set the updateTime
     *
     * @spring.validator type="required"
     */
    public void setUpdateTime(Date aValue) {
        this.updateTime = aValue;
    }

    /**
     * *
     *
     * @return Integer
     * @hibernate.property column="version" type="java.lang.Integer" length="10"
     * not-null="true" unique="false"
     */
    public Integer getVersion() {
        return this.version;
    }

    /**
     * Set the version
     *
     * @spring.validator type="required"
     */
    public void setVersion(Integer aValue) {
        this.version = aValue;
    }

    /**
     * @see java.lang.Object#equals(Object)
     */
    public boolean equals(Object object) {
        if (!(object instanceof InventoryTbl)) {
            return false;
        }
        InventoryTbl rhs = (InventoryTbl) object;
        return new EqualsBuilder().append(this.inventoryId, rhs.inventoryId)
                .append(this.quantityOnHand, rhs.quantityOnHand).append(
                        this.allocatedQuantity, rhs.allocatedQuantity).
                        append(this.reorderMinimnm, rhs.reorderMinimnm).append(
                        this.createTime, rhs.createTime).append(
                        this.updateTime, rhs.updateTime).append(this.version,
                        rhs.version).isEquals();
    }

    /**
     * @see java.lang.Object#hashCode()
     */
    public int hashCode() {
        return new HashCodeBuilder(-82280557, -700257973).append(
                this.inventoryId).append(this.quantityOnHand).append(
                this.allocatedQuantity).append(this.reorderMinimnm).append(
                this.createTime).append(this.updateTime).append(this.version)
                .toHashCode();
    }

    /**
     * @see java.lang.Object#toString()
     */
    public String toString() {
        return new ToStringBuilder(this)
                .append("inventoryId", this.inventoryId).append(
                        "quantityOnHand", this.quantityOnHand).append(
                        "allocatedQuantity", this.allocatedQuantity).
                        append("reorderMinimnm", this.reorderMinimnm).append(
                        "createTime", this.createTime).append("updateTime",
                        this.updateTime).append("version", this.version)
                .toString();
    }

    /**
     * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "inventoryId";
	}

	/**
	 * Return the Id (pk) of the entity, must be Integer
	 */
	public Integer getId() {
		return inventoryId;
	}

}